﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Planer.Model;

namespace Planer
{
    static class Program
    {
        static databaseEntities db = new databaseEntities();

        public static databaseEntities Db
        {
            get { return Program.db; }
        }

        private static UI.LoginForm loginForm = null;

        public static UI.LoginForm LoginForm
        {
            get { return Program.loginForm; }
        }
        private static FormMain mainForm = null;
        private static user currentUser = null;

        public static user CurrentUser
        {
            get { return Program.currentUser; }
        }

        public static FormMain MainForm
        {
            get { return Program.mainForm; }
        }

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            loginForm = new UI.LoginForm();

            if (loginForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Logic.PreExcecuter.Excecute(loginForm.CurrentUser);

            currentUser = loginForm.CurrentUser;
            mainForm = new FormMain();
            Application.Run(mainForm);
        }
    }
}
